#include <stdio.h>
#include <math.h>
// 7-1 第几天
int is_leap_year(int year)
{
    return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
void test1_7_1()
{
    int year, month, day;
    int days = 0;
    scanf("%d%d%d", &year, &month, &day);
    switch (month - 1)
    {
    case 11:
        days += 30;
    case 10:
        days += 31;
    case 9:
        days += 30;
    case 8:
        days += 31;
    case 7:
        days += 31;
    case 6:
        days += 30;
    case 5:
        days += 31;
    case 4:
        days += 30;
    case 3:
        days += 31;
    case 2:
        days += is_leap_year(year) ? 29 : 28;
    case 1:
        days += 31;
    }
    days += day;

    printf("%d", days);
}

// 7-2 整数之和

void test1_7_2()
{
    long long n, sum, s5, s7, s57;
    scanf("%lld", &n);

    s7 = n / 7;
    s5 = n / 5;
    s57 = n / 35;
    sum = (n * n + n) / 2;
    s5 = 5 * (s5 + 1) * s5 / 2;
    s7 = 7 * (s7 + 1) * s7 / 2;
    s57 = 35 * (s57 + 1) * s57 / 2;
    sum = sum - s5 - s7 + s57;

    printf("%lld", sum);
}

// 7-3 奇偶分家
void test1_7_3()
{
    char ch;
    int even = 0, odd = 0, digit = 0;
    while ((ch = getchar()) != '\n')
    {
        digit = ch - '0';
        if (digit & 1)
            odd = odd * 10 + digit;
        else
            even = even * 10 + digit;
    }

    printf("%d %d %d", even, odd, even - odd);
}

// 7-4 方程求根
double a, b, c, d;

double f(double x)
{
    return a * x * x * x + b * x * x + c * x + d;
}

double df(double x)
{
    return 3 * a * x * x + 2 * b * x + c;
}

void swap(double *a, double *b)
{
    double temp = *a;
    *a = *b;
    *b = temp;
}

double bisection(double left, double right)
{
    double mid = 0;
    while (right - left > 0.001)
    {
        mid = (left + right) / 2;
        if (fabs(f(mid)) < 0.001)
            return mid;
        if (f(mid) * f(left) > 0)
            left = mid;
        else
            right = mid;
    }

    return left;
}

double newton(double left, double right)
{
    double x1, x0 = (left + right) / 2;
    while (fabs(x0 - x1) > 0.001)
    {
        x1 = x0 - f(x0) / df(x0);
        swap(&x1, &x0);
    }

    return x1;
}

int test1_7_4()
{
    scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
    double x1 = -100, x4 = 100, x2, x3;
    // stationary point
    x2 = (-2 * b - sqrt(4 * b * b - 12 * a * c)) / (6 * a);
    x3 = (-2 * b + sqrt(4 * b * b - 12 * a * c)) / (6 * a);
    printf("%.2f %.2f %.2f", newton(x1, x2), newton(x2, x3), newton(x3, x4));

    return 0;
}

int main()
{
    return 0;
}